package com.xm.servlet.background.commodity;

import com.xm.service.background.CommodityService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 修改商品描述
 * @author 康文程
 * @date 2024-1-16 下午 03:55
 */
@WebServlet("/background/update/commodity/description")
public class UpdateCommodityDescriptionServlet extends HttpServlet {
    private final CommodityService service = new CommodityService();

    @SneakyThrows
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        String description = req.getParameter("description");
        String commodityId = req.getParameter("commodityId");
        System.out.println(description);
        System.out.println(commodityId);
        resp.getWriter().print(service.updateCommodityDescriptionById(Integer.parseInt(commodityId),description));
    }
}
